library(tidyverse)
library(janitor)

## THIS SCRIPT: PLOT PARTY POSITIONS ON IMMIGRATION 
## Original data is available here: https://manifesto-project.wzb.eu/datasets

rm(list = ls())

## Load Manifesto Data 

manif <- readxl::read_xlsx('data_private/MPDataset_MPDS2019b.xlsx') %>%
  filter(countryname == 'Germany') %>% 
  mutate(date = substr(date, 1, 4)) %>%
  filter(date == 2017) %>%
  dplyr::select(partyabbrev, per601_2) %>%
  mutate(partyabbrev = fct_reorder(partyabbrev, per601_2)) %>% 
  rename('Anti-immigration' = per601_2) %>%
  mutate(partyabbrev = recode(partyabbrev, 
                              '90/Greens' = 'Greens',
                              'LINKE' = 'Left Party')) %>%
  clean_names()


p1 <- ggplot(manif, aes(y = anti_immigration, x = partyabbrev)) + 
  geom_bar(stat = 'identity', width = .7) + 
  coord_flip() + 
  theme_bw() + 
  labs(x = '',
       y = 'Anti-immigration score (party manifesto)') + 
  theme(text = element_text(size = 16))

p1 
